using System;
using System.Drawing;
using System.Collections.Generic ;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Linq;

namespace QLTV.Reports
{
    public partial class rptVacation : DevExpress.XtraReports.UI.XtraReport
    {
        public rptVacation()
        {
            InitializeComponent();
        }
        int _stt = 0;
        private void rptVacation_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
           
        }

        private void GroupHeader1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            //_stt++;
            //stt.Text = _stt.ToString();
        }

        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
         
        }
        public void loadData(int rankID)
        {
            tadVacation.FillByRankID(dsReport1.tblVacation, rankID);

        }
        public void loadData(bool part1, bool part2, bool part3, bool part4)
        {
            tadVacation.Fill(dsReport1.tblVacation);
            Array listID = (from d in dsReport1.tblVacation.AsEnumerable()
                            orderby d.nRankID ascending
                            select d.nRankID).Distinct().ToArray();
            if (listID.Length > 0)
            {

                int middle1 = listID.Length / 2;
                int middle2 = (listID.Length - (middle1 + 1)) / 2;
                int middle3 = middle1 + (listID.Length - (middle1 + 1)) / 2;

                int middle1Value = (int)listID.GetValue(middle1);
                int middle2Value = (int)listID.GetValue(middle2);
                int middle3Value = (int)listID.GetValue(middle3);

                if (part1)
                    tadVacation.FillByLessOrEqual(dsReport1.tblVacation, middle2Value);
                if (part2)
                    tadVacation.FillByMiddle(dsReport1.tblVacation, middle2Value, middle1Value);
                if (part3)
                    tadVacation.FillByMiddle(dsReport1.tblVacation, middle1Value, middle3Value);
                if (part4)
                    tadVacation.FillByGreater(dsReport1.tblVacation, middle3Value);
            }

        }

    }
}
